Home:ALL Converter>When is a directory actually classed as been "accessed" on Windows?

When is a directory actually classed as been "accessed" on Windows?

Ask Time:2016-06-11T22:35:34         Author:carefulnow1

Json Formatter

I have this Console Application that gets a directory and prints out the last time it was written to and the last time time it was accessed. I am using the following code for checking when it was written to: Directory.GetLastWriteTime(path) and the following code for checking when it was last accessed to: Directory.GetLastAccessTime(path). You don't need to be much of a programmer to see that from that, I am using the correct methods.

Now the problem is that when I pass in top level C:\ (or any directory) to path, the access time always matches the write time. Even when I have just opened up a few files in top level C, but not written to it. See here:

Opening the C:\ Drive and accessing a file

However, when I run the code I supplied to at the top I get this:

Wrong time

This was not the time I just opened that file. So now that leads me to believe that "accessing" a file is not what I think. Is that true, or is it a bug somewhere?

Author:carefulnow1,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37764927/when-is-a-directory-actually-classed-as-been-accessed-on-windows
yy